<template>
  <el-dialog v-model="dialogFormVisible" :title="dialogFormTitle">
    <el-form :model="formdata">
      <el-form-item label="车次" :label-width="formLabelWidth">
        <el-input v-model="formdata.trainno" autocomplete="off" readonly />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="当前站点" :label-width="formLabelWidth">
        <el-input v-model="formdata.fromnm" autocomplete="off" />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="下一站" :label-width="formLabelWidth">
        <el-input v-model="formdata.tonm" autocomplete="off" />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="停留时长" :label-width="formLabelWidth">
        <el-input v-model="formdata.waitfor" autocomplete="off" />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="到下一站的运行时长" :label-width="formLabelWidth">
        <el-input v-model="formdata.running" autocomplete="off" />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="到站时间" :label-width="formLabelWidth">
        <el-input v-model="formdata.totime" autocomplete="off" />
      </el-form-item>
    </el-form>
    <el-form :model="formdata">
      <el-form-item label="开车时间" :label-width="formLabelWidth">
        <el-input v-model="formdata.ltime" autocomplete="off" />
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogFormVisible = false">Cancel</el-button>
        <el-button type="primary" @click="scheduleStore.save" :icon="Promotion"> 保存 </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
import { storeToRefs } from 'pinia'

import { Promotion } from '@element-plus/icons-vue'
import { useScheduleStore } from '../../stores/schedule'

const scheduleStore = useScheduleStore()

const { dialogFormVisible, dialogFormTitle, formdata } = storeToRefs(scheduleStore)

const formLabelWidth = '140px'
</script>
<style scoped>
.el-button--text {
  margin-right: 15px;
}
.el-select {
  width: 300px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
